package com.xjoyt.pay.master.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xjoyt.pay.controllers.AbstractController;
import com.xjoyt.pay.dto.ExecuteResult;
import com.xjoyt.pay.dto.PageParam;
import com.xjoyt.pay.dto.PageResult;
import com.xjoyt.pay.gateway.params.CashParam;
import com.xjoyt.pay.master.interfaces.CashContract;
import com.xjoyt.pay.master.params.CashDetailPageParam;
import com.xjoyt.pay.master.params.MerchantCashPageParam;
import com.xjoyt.pay.master.po.Cash;
import com.xjoyt.pay.master.po.CashDetail;
import com.xjoyt.pay.master.services.CashService;
import com.xjoyt.pay.master.vo.CashMap;

@RestController
@RequestMapping("cash")
public class CashController extends AbstractController implements CashContract {

	@Autowired
	private CashService service;

	@Override
	public PageResult<CashMap> loadPage(@RequestBody PageParam<MerchantCashPageParam> param) {
		return service.loadPage(param);
	}

	@Override
	public PageResult<com.xjoyt.pay.master.vo.CashDetail> loadPageMap(
			@RequestBody PageParam<CashDetailPageParam> param) {
		return service.loadPageMap(param);
	}

	@Override
	public ExecuteResult<Cash> check(@PathVariable("id") String id, @PathVariable("check") Boolean check) {
		return service.check(id, check);
	}

	@Override
	public ExecuteResult<Cash> create(@RequestBody CashParam param) {
		return service.create(param);
	}

	@Override
	public ExecuteResult<CashDetail> cashSingle(@PathVariable("id") String id) {
		return service.send(id);
	}

}
